<?php
/**
 * CourseType Controller
 * 
 * @package    	ReportManager
 * @author		Internet Apps Development Course
 * @copyright	
 */

// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

class ReportManagerControllerCourseType extends ReportManagerController
{
	function __construct()
	{
		parent::__construct();
		$this->registerTask( 'edit' , 'add', 'save' );
	}

	function edit()
	{
		JRequest::setVar( 'view', 'CourseType'  );
		parent::display();
	}

	function save()
	{
		$model = $this->getModel("CourseType");
		if ($model->store()) {
			$msg = 'Done!';
		} else {
			$msg = 'Error!';
		}

		$link = 'index.php?option=com_reportmanager&controller=coursetype';
		$this->setRedirect($link, $msg);
	}

	function cancel()
	{
		$msg = 'Операция отменена';
		$this->setRedirect( 'index.php?option=com_reportmanager&controller=coursetype', $msg );
	}

	function display()
	{
		JRequest::setVar( 'view', 'coursetype'  );
		parent::display();
	}
}